<template>
    <!-- <Student/> -->
     <!-- 把person标签的ref属性和ren这个对象联系到一起 -->
     <Person ref="ren"/>
     <button @click="fun">点我显示</button>
</template>


<!-- 父组件 -->
<script setup lang="ts" name="App">
    //import Student from './components/Student.vue'
    import Person from './components/Person.vue'
    import {ref} from 'vue'
    //创建一个ref函数返回的对象
    let ren=ref();

    function fun(){
        console.log(ren.value.name);
        console.log(ren.value.age);
    }

</script>

<style>
.app {
    background-color: beige;
    /*背景颜色 */
    padding: 30px;
    /*内边距 */
    box-shadow: 0 0 10px;
    /*边框阴影 */
    border-radius: 10px;
}
</style>